]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Support setting notification icon by name
authorJulian Sparber <julian@sparber.net>
Sat, 27 Jan 2024 13:18:41 +0000 (14:18 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 6 Feb 2024 17:25:01 +0000 (17:25 +0000)
Since we now display the source icon and an image for the notification,
it's quite common to set an icon from a name. Therefore add a
convenience property to do so.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3156>

js/ui/messageTray.js

index 7427b4a51ef23082cf06766a506ffa3960de6e4f..479044a3adbe30896038bb2126211599c7fb28a6 100644 (file)
@@ -431,6 +431,17 @@ export const Notification = GObject.registerClass({
         this.emit('updated', params.clear);
     }
 
+    get iconName() {
+        if (this.gicon instanceof Gio.ThemedIcon)
+            return this.gicon.iconName;
+        else
+            return null;
+    }
+
+    set iconName(iconName) {
+        this.gicon = new Gio.ThemedIcon({name: iconName});
+    }
+
     // addAction:
     // @label: the label for the action's button
     // @callback: the callback for the action